-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nix: make derivation and update shell #1003
base: master
Are you sure you want to change the base?
Conversation
fadb206
to
a5bc0bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff.
nix/version.nix
Outdated
let | ||
tools = pkgs.callPackage ./tools.nix {}; | ||
source = ../codex.nimble; | ||
|
||
version = tools.findKeyValue "version = \"([0-9]+\.[0-9]+\.[0-9]+)\"" source; | ||
in | ||
"${version}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version
variable is pointless, and so it interpolating it after the let
/in
block.
let | |
tools = pkgs.callPackage ./tools.nix {}; | |
source = ../codex.nimble; | |
version = tools.findKeyValue "version = \"([0-9]+\.[0-9]+\.[0-9]+)\"" source; | |
in | |
"${version}" | |
let | |
tools = pkgs.callPackage ./tools.nix {}; | |
in | |
tools.findKeyValue "version = \"([0-9]+\.[0-9]+\.[0-9]+)\"" ../codex.nimble; |
Honestly, this is so short you could just put this directly in nix/default.nix
.
@@ -3,33 +3,36 @@ | |||
|
|||
inputs = { | |||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; | |||
circom-compat.url = "github:codex-storage/circom-compat-ffi"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't reference it by relative path? Might be possible:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did try it with relative path, but the problem is the .?submodules=1
part when building the derivation. Since we declare the circom-compat
flake as input when the submodules are not cloned yet, the build fails because the flake file is not present yet on the filesystem. Because of that I am using the GitHub URL here.
flake.nix
Outdated
inherit stableSystems; | ||
inherit circomCompatPkg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inherit stableSystems; | |
inherit circomCompatPkg; | |
inherit stableSystems circomCompatPkg; |
nix/default.nix
Outdated
nativeBuildInputs = let | ||
# Fix for Nim compiler calling 'git rev-parse' and 'lsb_release'. | ||
fakeGit = writeScriptBin "git" "echo ${version}"; | ||
fakeLsbRelease = writeScriptBin "lsb_release" "echo nix"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you using this instead of lsb-release
package?
flake.nix
Outdated
devShells = forAllSystems (system: { | ||
default = pkgsFor.${system}.callPackage ./nix/shell.nix { }; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could just use the package itself to get necessary tools, and add others using buildInputes
:
devShells = forAllSystems (system: { | |
default = pkgsFor.${system}.callPackage ./nix/shell.nix { }; | |
}); | |
devShells = forAllSystems (system: let | |
pkgs = pkgsFor.${system}; | |
in { | |
default = pkgs.mkShell { | |
inputsFrom = [ | |
packages.${system}.codex | |
circom-compat.packages.${system}.default | |
]; | |
buildInputs = with pkgs; [ git nodejs_18 ]; | |
}; | |
}); |
Are we even using this llvmPackages.openmp
thing? I don't see it in the build. Built fine without it on my host.
nix/default.nix
Outdated
"x86_64-linux" "aarch64-linux" | ||
"x86_64-darwin" "aarch64-darwin" | ||
], | ||
circomCompatPkg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a default fallback here too:
circomCompatPkg | |
circomCompatPkg ? ( | |
builtins.getFlake "github:codex-storage/circom-compat-ffi" | |
).packages.${builtins.currentSystem}.default |
nix/default.nix
Outdated
curl | ||
bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bash is a part of stdenv
, and curl
makes no sense.
nix/default.nix
Outdated
openssl | ||
gmp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't we already adding this in buildInputs
?
nix/default.nix
Outdated
inherit (pkgs) stdenv lib writeScriptBin callPackage; | ||
|
||
revision = lib.substring 0 8 (src.rev or "dirty"); | ||
in pkgs.stdenv.mkDerivation rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be enforcing GCC11?
in pkgs.stdenv.mkDerivation rec { | |
in pkgs.gcc11Stdenv.mkDerivation rec { |
nix/default.nix
Outdated
fakeCargo = writeScriptBin "cargo" "echo ${version}"; | ||
in | ||
with pkgs; [ | ||
gcc11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done using gcc11Stdenv.mkDerivation
.
Create a structure for nix files. Add the derivation file which is using system Nim to compile Codex. Move shell definition to a specific file. Referenced issue: #940 Signed-off-by: markoburcul <[email protected]>
Signed-off-by: markoburcul <[email protected]>
a5bc0bd
to
ce38490
Compare
Create a structure for nix files. Add the derivation file which is using system Nim to compile Codex. Move shell definition to a specific file.
Referenced issue: #940